<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    /*
        1.打印顺序
        p353下面中打印顺序错误
     */

    async function f1() {
        console.log(await Promise.resolve('f1'))
    }

    async function f2() {
        console.log(await 'f2')
    }

    async function f3() {
        console.log('f3')
    }

    f1();
    f2();
    f3();

    /*
        google结果: f3 f1 f2
        safari结果: f3 f2 f1
     */

    /*
        2. 第二个例子
     */

    async function f4() {
        console.log(2)
        console.log(await Promise.resolve(8))
        console.log(9)
    }

    async function f5() {
        console.log(4);
        console.log(await 6);
        console.log(7);
    }

    console.log(1);
    f4();
    console.log(3);
    f5();
    console.log(5);
    
    /*
        google浏览器打印: 123458967
        safari浏览器打印: 123456789
     */
</script>
</body>
</html>